﻿<%@ Page Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true"
    Codebehind="articleAE.aspx.cs" Inherits="CMS.admin.articleAE" Title="Hệ thống quản trị nội dung - quản lý tin bài" %>

<%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<%--    <link href="../css/combobox.css" type="text/css" rel="stylesheet" />
    <link href="../css/treeStyle.css" type="text/css" rel="stylesheet" />--%>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script language="javascript">   
        function doDeleteAnhtin()
        {
            document.getElementById('<%=imgTinbai.ClientID%>').src = "../images/noimage.jpg";
            document.getElementById('<%=deleteAnhtin.ClientID%>').style.visibility = "hidden";
            document.getElementById('<%=txtAnhtin.ClientID%>').value = "";
        }
        function callAnhtin()  
        {  
		    var editor1 = document.getElementById('<%=anhtin.ClientID%>');
            editor1.FocusDocument();  
            var editdoc = editor1.GetDocument();  
            editor1.ExecCommand('new');
            editor1.ExecCommand('ImageGalleryByBrowsing');            
            InputURLSmall();
            document.getElementById('<%=imgTinbai.ClientID%>').focus(); 
        }    
        
        function InputURLSmall()
        { 
		    var editor1 = document.getElementById('<%=anhtin.ClientID%>');		    
            var editdoc = editor1.GetDocument();              
            var imgs = editdoc.images;
            if(imgs.length>0)  
            {
                var filepath = imgs[imgs.length-1].src;
                //var filename = filepath.substring(filepath.lastIndexOf("/uploads/")+1,filepath.length);
                //Remove "/uploads/" string
                var filename = filepath.substring(filepath.lastIndexOf("/uploads/")+9,filepath.length);
                document.getElementById("<%=txtAnhtin.ClientID%>").value = filename;
                document.getElementById('<%=imgTinbai.ClientID%>').src = filepath;   
                document.getElementById('<%=deleteAnhtin.ClientID%>').style.visibility = "visible";
            }  
            else
            {
			    setTimeout(InputURLSmall,500); 
            }  
        }
         function OpenArticles()
         {
             var swidth=800; 
            var sheight=600; 
            var sUrl = "toolbar=no,resizable=1,scrollbars=yes,width=" + swidth + "px,height=" + sheight +"px";
            window.open('articleSelect.aspx','relation',sUrl);
            return false;
         }
          function TreeView1_onNodeSelect(sender, eventArgs)
          {
            cboCategory.set_text(eventArgs.get_node().get_text());
            document.getElementById('<%=hfSelect.ClientID %>').value=eventArgs.get_node().get_value();
            cboCategory.collapse();
          }
             //Ham chan chi cho phep nhap kieu so
          function isNumberKey(evt)
           {
	        var charCode = (evt.which) ? evt.which : event.keyCode
	        if (charCode > 31 && (charCode < 48 || charCode > 57))
	        return false;

	        return true;
           }
    </script>

    <div style="border: solid 1px #ccc;">
        <div id="toolbox">
            <div class="header" style="float: left; margin-left: -40px;">
                <img src="../images/Toolbox/title-article.png" alt="" id="imgHeader" />
                Quản lý tin bài: thêm/sửa
            </div>
            <div style="float: right;">
                <table class="toolbar">
                    <tr>
                        <td align="center">
                            <asp:LinkButton ID="btnUpdate" runat="server" OnClick="btnUpdate_Click">
                                <asp:Label ID="Label1" CssClass="Icon-32-Save" runat="server" />
                                Cập nhật
                            </asp:LinkButton>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="btnClose" CausesValidation="false" runat="server" OnClick="btnClose_Click">
                                <asp:Label ID="Label4" CssClass="Icon-32-Cancel" runat="server" />
                                Đóng lại
                            </asp:LinkButton>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <p align="center">
        <asp:Label ID="lblMessage" runat="server" BackColor="White" BorderColor="White" ForeColor="Red"></asp:Label>
        <input type="hidden" name="hfIdArticleSelected" id="hfIdArticleSelected" />
        <asp:HiddenField ID="hfSelect" runat="Server" />
        <asp:HiddenField ID="hfIdArticleSelected_Edit" runat="Server" />
    </p>
    <div id="content-box">
        <div class="t">
            <div class="t">
                <div class="t">
                </div>
            </div>
        </div>
        <div class="m">
            <!--table2:data form-->
            <table width="830" cellpadding="5" border="0" cellspacing="5">
                <tr>
                    <td align="left" colspan="2">
                        <h2 style="font-size: larger;">
                            Thông tin chung</h2>
                    </td>
                    <td rowspan="4" style="text-align: left; width: 150px; vertical-align: bottom;">
                        <table width="150" height="150" border="0">
                            <tr>
                                <td style="vertical-align: bottom; width: 130px;">
                                    <img id="imgTinbai" runat="Server" alt="" src="../images/noimage.jpg" border="0" />
                                </td>
                                <td style="vertical-align: bottom;">
                                    <img src="../images/deleteAnhtin.gif" runat="Server" alt="" title="Xóa ảnh" id="deleteAnhtin" onclick="javascript:doDeleteAnhtin();"
                                        style="visibility: hidden; cursor: pointer;" border="0" /></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px">
                        <asp:Label ID="lblGroupName" runat="server" Text="Chọn chuyên mục:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left; width: 390px;">
                        <ComponentArt:ComboBox ID="cboCategory" runat="server" KeyboardEnabled="false" AutoFilter="false"
                            AutoHighlight="false" AutoComplete="false" CssClass="comboBox" HoverCssClass="comboBoxHover"
                            FocusedCssClass="comboBoxHover" TextBoxCssClass="comboTextBox" DropDownCssClass="comboDropDown"
                            ItemCssClass="comboItem" ItemHoverCssClass="comboItemHover" SelectedItemCssClass="comboItemHover"
                            DropHoverImageUrl="../images/drop_hover.gif" DropImageUrl="../images/drop.gif"
                            Width="360" DropDownHeight="400" DropDownWidth="360">
                            <DropDownContent>
                                <ComponentArt:TreeView ID="TreeView1" DragAndDropEnabled="false" NodeEditingEnabled="false"
                                    KeyboardEnabled="true" CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode"
                                    HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit" LineImageWidth="19"
                                    LineImageHeight="20" DefaultImageWidth="16" BorderColor="white" DefaultImageHeight="16" ItemSpacing="0"
                                    NodeLabelPadding="3" LineImagesFolderUrl="../images/lines/" Height="400" Width="350"
                                    ShowLines="true" EnableViewState="true" runat="server">
                                    <ClientEvents>
                                        <NodeSelect EventHandler="TreeView1_onNodeSelect" />
                                    </ClientEvents>
                                </ComponentArt:TreeView>
                            </DropDownContent>
                            <DropDownFooter>
                            </DropDownFooter>
                        </ComponentArt:ComboBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="Label2" runat="server" Text="Tiêu đề bài viết:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left; width: 390px;">
                        <asp:TextBox ID="txtTitle" runat="server" Width="360px"></asp:TextBox>
                        <font color="#ff0000">*</font>&nbsp;&nbsp;&nbsp;
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtTitle"
                            ErrorMessage="Trường bắt buộc nhập liệu"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="lblFullName" runat="server" Text="Ảnh bài viết:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left; width: 390px; vertical-align: baseline;">
                        <asp:TextBox ID="txtAnhtin" runat="Server" Width="290px"></asp:TextBox>
                        &nbsp;&nbsp;<input type="Button" id="btnAnhtin" onclick="callAnhtin()" value="Chọn ảnh" />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="Label5" runat="server" Text="Mô tả nội dung:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left" colspan="2">
                        <CE:Editor ID="txtContent" runat="server" EditorWysiwygModeCss="../css/style.css" AutoConfigure="Minimal" Height="200px" ShowBottomBar="False"
                            ShowHtmlMode="False" Width="643px">
                            <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                                CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                        </CE:Editor>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="Label6" runat="server" Text="Nội dung tin bài:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left" colspan="2">
                        <CE:Editor ID="txtDetail" runat="server" EditorWysiwygModeCss="../css/style.css" AutoConfigure="Simple" ThemeType="Office2003_BlueTheme"
                            Width="644px">
                            <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                                CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                        </CE:Editor>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="Label10" runat="server" Text="Trạng thái:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left;" colspan="2">
                        <asp:DropDownList ID="ddlStatus" runat="server" Width="200px">
                            <asp:ListItem Selected="True" Value="0">Chờ duyệt</asp:ListItem>
                            <asp:ListItem Value="1">Xuất bản</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="Label9" runat="server" Text="Thứ tự:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left; width: 390px; vertical-align: baseline;">
                        <asp:TextBox ID="txtOrder" runat="Server" Width="290px" onkeypress="return isNumberKey(event);"
                            MaxLength="3"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="left" valign="top" colspan="3">
                        <h3>
                            Thông tin khác</h3>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="Label3" runat="server" Text="Nguồn tin:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left" colspan="2">
                        <asp:TextBox ID="txtSource" runat="server" Width="360px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="Label7" runat="server" Text="Tin liên quan:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left" colspan="2">
                        <asp:LinkButton ID="lnkOpenForm" runat="Server" Text="Chọn tin" Font-Bold="true" CausesValidation="false"
                            OnClientClick=" return OpenArticles();"></asp:LinkButton>
                        <ul id="idTinLienQuan">
                            <asp:Label ID="lblTinLienQuan" runat="Server"></asp:Label>
                            <%-- <li>Hà Lan - Cameroon: Hàng phục sư tử</li>
                            <li>Đan Mạch – Nhật Bản: Nắm lấy vận mệnh</li>
                            <li>Tản mạn World Cup: Nhân cách của kẻ phản bội</li>--%>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="Label8" runat="server" Text="Ghi chú:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left" colspan="2">
                        <asp:TextBox ID="txtComment" runat="server" Width="360px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 150px" valign="top">
                        <asp:Label ID="lblHistory" runat="server" Text="Lịch sử bài viết:" Font-Bold="True"></asp:Label>
                    </td>
                    <td style="text-align: left" colspan="2">
                        <asp:TextBox ID="txtHistory" runat="Server" TextMode="MultiLine" Width="643px" ReadOnly="true" Height="70px"></asp:TextBox>
                        <%--<textarea name="AllComment" readonly="readonly" id="AllComment" cols="70" rows="7">- [Lưu và xuất bản lại] [bởi user1 lúc 21/06/2010 16:35:22] 
- [Lưu và xuất bản lại] [bởi user2 lúc 21/06/2010 16:10:50] 
- [Đẩy từ PRIVATE lên PUBLISHED] user3 lúc 16/06/2010 16:58:58] 
- [Tạo mới bài] [trongtv lúc 16/06/2010 16:58:58] 
                        </textarea>--%>
                    </td>
                </tr>
                <tr>
                    <td align="left" valign="top" colspan="3">
                        <CE:Editor ID="anhtin" FilesPath="" EnableObjectResizing="false" BorderColor="white"
                            runat="server" Width="1px" Height="1px" AutoConfigure="None" ShowHtmlMode="False"
                            ShowPreviewMode="False" EnableContextMenu="false" ShowGroupMenuImage="False"
                            ShowBottomBar="False" BackColor="White">
                            <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                                CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                        </CE:Editor>
                    </td>
                </tr>
            </table>
            <!--end:table2-->
            <br />
            <div class="clr">
            </div>
        </div>
        <div class="b">
            <div class="b">
                <div class="b">
                </div>
            </div>
        </div>
    </div>
</asp:Content>
